{% extends "admin/layout.html" %}

{% block head %} 
<title>{{ _(config["WEBSITE_NAME"]) }} - {{ _("Users") }}</title>
  {% if session["direction"] == "rtl" %}
    <style type="text/css">
      .list-unstyled {
        padding-right: 0;
      }
    </style>
  {% endif %}
{% endblock %}

{% block body %}
<div class="right_col" role="main" style="min-height: 939px;">
  <div class="">
    <div class="page-title">
      <div class="title_left">
        <h3>{{ _("Users") }}</h3>
      </div>
  </div>
    <div class="clearfix"></div>
    <div class="row">
      <div class="col-md-12">
        <div class="x_panel">
          <div class="x_content">
            <div class="row">                      
              <div class="clearfix"></div>
              <div class="clearfix"></div>
              {% for user in query %}
                <div class="col-md-4 col-sm-4 col-xs-12 profile_details">
                  <div class="well profile_view">
                    <div class="col-sm-12">
                      <div class="left col-xs-7">
                        <h2>{{ user.fullname.title() }}</h2>
                        <p><strong>{{ _("About") }}: </strong> {{ user.description }} </p>
                        <ul class="list-unstyled">
                          <li><i class="fa fa-user-secret"></i> <strong>{{ _("Privilege") }}:</strong> {{ user.privilege }}</li>
                          <li><i class="fa fa-envelope"></i> <strong>{{ _("Email") }}:</strong> {{ user.email }}</li>
                          <li><i class="fa fa-user"></i> <strong>{{ _("Username") }}:</strong> {{ user.username }}</li>
                        </ul>
                      </div>
                      <div class="right col-xs-5 text-center" style="float: right !important;">
                        <img src="{{ url_for('static', filename='images/user.png') }}" alt="{{ _('user avatar') }}" class="img-circle img-responsive">
                      </div>
                    </div>
                    <div class="col-xs-12 bottom text-center">
                      <div class="col-xs-12 col-sm-12 emphasis">
                        <form method="GET" action="{{ url_for('admin.users_config') }}">
                          {% if user.privilege != "admin" %}
                            <input type="submit" name="submit" class="btn btn-primary btn-xs" value="{{ _('Promote') }}">
                          {% else %}
                            {% if session.current_user["id"] != user.Id %}
                              <input type="submit" name="submit" class="btn btn-info btn-xs" value="{{ _('Demote') }}">
                            {% endif %}
                          {% endif %}
                          {% if session.current_user["id"] != user.Id %}
                            <input type="submit" name="submit" class="btn btn-danger btn-xs" value="{{ _('Delete') }}">
                          {% endif %}
                          <input type="hidden" name="id" value="{{ user.Id }}">
                        </form>
                      </div>
                    </div>
                  </div>
                </div>
              {% endfor %}
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
{% endblock %}